package win.timloong.android.carwiki.util;

import android.net.Uri;
import android.widget.ImageView;

import com.squareup.picasso.Picasso;

import java.io.File;

import win.timloong.android.carwiki.R;
import win.timloong.android.carwiki.application.CarWikiApplication;

/**
 * Created by tim on 16/7/12.
 */

public class ImageUtil {
    public  static  void loadImage(String path, ImageView target){
        Picasso.with(CarWikiApplication.context)
                .load(path)
                .error(R.mipmap.ic_launcher)
                .placeholder(R.mipmap.ic_launcher)
                .into(target);
    }

    public  static  void loadImage(File file, ImageView target){
        Picasso.with(CarWikiApplication.context)
                .load(file)
                .error(R.mipmap.ic_launcher)
                .placeholder(R.mipmap.ic_launcher)
                .into(target);
    }

    public  static  void loadImage(Uri uri, ImageView target){
        Picasso.with(CarWikiApplication.context)
                .load(uri)
                .error(R.mipmap.ic_launcher)
                .placeholder(R.mipmap.ic_launcher)
                .into(target);
    }

    public  static  void loadImage(int res, ImageView target){
        Picasso.with(CarWikiApplication.context)
                .load(res)
                .error(R.mipmap.ic_launcher)
                .placeholder(R.mipmap.ic_launcher)
                .into(target);
    }
}
